import { Fragment } from '@tarojs/taro'
import dayjs from 'dayjs'

import ListItem from '../../components/listItem'

import './index.less'

export const Info = ({ info }) => {
  return (
    <Fragment>
      <View className="member-info-list">
        <ListItem label="头像" border>
          <View>
            <Image src={ info.imgUrl } style={{ marginRight: 0 }} />
          </View>
        </ListItem>
        <ListItem label="姓名" border>
          <Text>{ info.name }</Text>
        </ListItem>
        <ListItem label="性别" border>
          <Text>{ info.sexStr }</Text>
        </ListItem>
        <ListItem label="出生年月" border>
          <Text>{ info.birthday ? info.birthday : '' }</Text>
        </ListItem>
        <ListItem label="年龄" border>
          <Text>{ info.age }</Text>
        </ListItem>
        <ListItem label="电话">
          <Text>{ info.mobile }</Text>
        </ListItem>
      </View>
      <View className="member-info-list">
        <ListItem label="VIP状态" border>
          <Text>{ info.statusStr }</Text>
        </ListItem>
        <ListItem label="VIP到期时间">
          <Text>{ info.expiredTime ? info.expiredTime : '' }</Text>
        </ListItem>
      </View>
      <View className="member-info-list">
        <ListItem label="注册时间" border>
          <Text>{ dayjs(info.createTime).format('YYYY-MM-DD') }</Text>
        </ListItem>
        <ListItem label="注册方式" border>
          <Text>{ info.registerType }</Text>
        </ListItem>
        <ListItem label="推广人（转介绍会员）" border>
          <Text>{ info.promoter }</Text>
        </ListItem>
        <ListItem label="推广人电话" >
          <Text>{ info.promoterMobile }</Text>
        </ListItem>
      </View>
    </Fragment>
  )
}

Info.defaultProps = {
  info: {}
}